//*****************************************************************
// ControlAlgorithm.h
//
//  Created on: Jan 21, 2012
//      Author: Christopher Wood
//              Robert Livosi
//
//  $Id: ControlAlgorithm.h 33 2012-01-30 13:13:24Z caw4567 $
//*****************************************************************

#ifndef CONTROLALGORITHM_H_
#define CONTROLALGORITHM_H_

#include "Project2.h"

/**
 * This is an abstract parent class for all control algorithms that provides
 * a unified interface for easy swapping of the desired algorithm at runtime.
 * This is the interface in the Strategy pattern.
 */
class ControlAlgorithm
{
public:
	/**
	 * Default constructor.
	 */
	ControlAlgorithm();

	/**
	 * Default destructor.
	 */
	virtual ~ControlAlgorithm();

	/**
	 * Abstract method that is used to prompt the user for the
	 * new algorithm parameters.
	 *
	 * @return a string for the user to interpret.
	 */
	virtual string getParamString() = 0;

	/**
	 * Helper method to determine the number of parameters
	 *
	 * @return the number of parameters needed to collect
	 */
	virtual int getParamLength() = 0;

	/**
	 * Abstract method to set the parameters of the algorithm.
	 *
	 * @param params - string of new parameters
	 * @returns true if parsing was successful, false otherwise.
	 */
	virtual bool setParams(vector<string> params) = 0;

	/**
	 * Compute the transform based on the specified input.
	 *
	 * @param reference - the desired set point
	 * @param input - the new input
	 * @return the new output
	 */
	virtual float computeTransform(float reference, float input) = 0;

	/**
	 * Reset the control algorithm history buffers.
	 */
	virtual void reset() = 0;
};

#endif /* CONTROLALGORITHM_H_ */
